Skip to content

feat(mship): async runs - #6329

Merged
Sg312 merged 1 commit into
stagingfrom
mship-async-runs
Aug 6, 2026
Merged

feat(mship): async runs#6329
Sg312 merged 1 commit into
stagingfrom
mship-async-runs

Conversation

@Sg312

@Sg312 Sg312 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Mship async run workflow

Companion: https://github.com/simstudioai/mothership/pull/411

Type of Change

  • New feature

Testing

Manual

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 6, 2026 6:21pm

Request Review

@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds asynchronous Copilot run_workflow launches, carrying execution correlation through the queue and reporting accepted background runs without waiting for completion. It also adds deployment preflight errors and removes scheduled-task entries from generated tool artifacts.

  • Adds browser-side async enqueueing and interrupted-confirmation recovery.
  • Propagates Copilot tool-call and trigger-block correlation into background workflow execution.
  • Enforces deployed/current workflow state for bound async launches.
  • Extends structural confirmation handling for allowlisted deployment failures.

Confidence Score: 4/5

The PR should not merge until the undeployed async-workflow path releases its reserved execution slot.

A rejected bound async launch currently retains an admission slot until expiration, allowing repeated preflight failures to incorrectly exhaust workflow concurrency for the billing account.

Files Needing Attention: apps/sim/app/api/workflows/[id]/execute/route.ts

Important Files Changed

Filename Overview
apps/sim/app/api/workflows/[id]/execute/route.ts Adds bound async Copilot execution and deployment preflight handling, but the undeployed-workflow return leaks its reserved execution slot.
apps/sim/lib/copilot/tools/client/run-tool-execution.ts Adds asynchronous queueing, background confirmation, and tab-local recovery for client workflow tools.
apps/sim/background/workflow-execution.ts Preserves Copilot correlation and trigger-block selection when executing queued workflow jobs.
apps/sim/app/api/copilot/confirm/route.ts Projects only allowlisted async deployment failures into structural tool confirmations.
apps/sim/lib/copilot/request/handlers/tool.ts Treats an accepted explicitly asynchronous workflow launch as a successful tool result.
apps/sim/lib/copilot/generated/tool-catalog-v1.ts Adds the run_workflow async parameter and removes scheduled-task tool definitions from the generated catalog.

Sequence Diagram

sequenceDiagram
  participant M as Mothership
  participant B as Browser client
  participant API as Workflow execute route
  participant Q as Job queue
  participant W as Background worker
  M->>B: "run_workflow(async=true)"
  B->>API: POST execute (X-Execution-Mode: async)
  API->>API: Authenticate, claim IDs, preprocess
  alt deployment valid
    API->>Q: Enqueue correlated execution
    API-->>B: 202 + executionId
    B-->>M: background confirmation
    Q->>W: Execute deployed workflow
  else missing or stale deployment
    API-->>B: Structured deployment error
    B-->>M: Allowlisted failure confirmation
  end
Loading

Reviews (1): Last reviewed commit: "Fix lint" | Re-trigger Greptile

Comment thread apps/sim/app/api/workflows/[id]/execute/route.ts
@Sg312
Sg312 force-pushed the mship-async-runs branch from e3d1226 to 0c79a18 Compare August 6, 2026 18:21
@github-actions github-actions Bot added the requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep label Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

⚠️ Cross-repo companion check

One or more companion PRs aren't merged into staging yet. Merging this without them will leave copilot and sim out of sync — merge them in lockstep.

@Sg312
Sg312 merged commit 93b68f0 into staging Aug 6, 2026
28 checks passed
@waleedlatif1
waleedlatif1 deleted the mship-async-runs branch August 6, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant